package com.mp.approvalreq.entity;

import com.alibaba.fastjson.JSONObject;
import com.mp.approvalreq.util.EmailUtils;
import com.mp.user.entity.User;

import java.math.BigDecimal;
import java.util.List;

public class Template {
    /**
     * 报销
     */
    public final static int EXPENSES = 1;
    /**
     * 请假
     */
    public final static int LEAVE = 2;
    /**
     * 外出
     */
    public final static int OUTDOOR = 3;
    /**
     * 申购
     */
    public final static int PURCHASE = 4;
    /**
     * 未打卡
     */
    public final static int APPEND_SIGN = 5;
    /**
     * 其他自定义
     */
    public final static int OTHER = 6;
    /**
     * 出差
     */
    public final static int BUSINESS_TRIP = 7;
    /**
     * 补假
     */
    public final static int COMPENSATORY_LEAVE = 8;
    /**
     * 加班
     */
    public final static int WORK_OVERTIME = 9;

    /**
     * 借款
     */
    public final static int LEND_MONEY = 10;
    /**
     * 调休
     */
    public final static int DAYS_OFF = 12;

    /**
     * 模板id
     */
    private int templateId;

    /**
     * 模板新插入id
     */
    private Integer templateInsertId;
    /**
     * 审批名字:晚餐报销
     */
    private String templateName;
    /**
     * 模板名称:报销模板
     */
    private String templateMetaName;
    /**
     * 模板备注
     */
    private String templateTips;
    /**
     * 模板组件格式为：[{num:type:name:need},{num:type:name:need}]
     */
    private String templateComponent;
    /**
     * 公用模板为0
     */
    private Integer companyId;
    /**
     * 公用模板为0,
     */
    private String departmentId;
    /**
     * 模板状态0不启用，1启用
     */
    private Integer status;
    /**
     * 审批流，默认为default(逐层审批)，自定义格式为:SP(直属主管),DM(部门主管),人,人,人，第三种是：人，人，人，人
     */
    private String requestFlow;
    /**
     * 抄送xx,xx,xx,xx
     */
    private String cc;
    /**
     * {num:[文字，文字，文字],num:[文字，文字，文字]}
     */
    private String multiChosen;
    /**
     * 模板颜色
     */
    private String templateColor;
    /**
     * 模板版本
     */
    private int version;
    /**
     * 默认模板类型,1-7
     */
    private int defaultType;
    /**
     * 报销金额上限
     */
    private BigDecimal amountTop;
    /**
     * 金额
     */
    private BigDecimal amount;
    /**
     * 查看第几页
     */
    private Integer page;
    /**
     * 每页的数据数
     */
    private Integer dataNum;
    /**
     * 以什么为排序依据,date,type
     */
    private String orderBy;
    /**
     * 以什么为筛选依据
     */
    private String siftingBy;
    /**
     * 数据总条数
     */
    private int totalCount;
    /**
     * 祖先id，就是是根据哪个祖先模板改的，不包含默认模板
     */
    private Integer ancestorId;
    /**
     * 祖先id，就是是根据哪个祖先模板改的，不包含默认模板
     */
    private String ancestorIds;
    /**
     * 最新的模板id
     */
    private Integer latestTemplateId;
    /**
     * 最新的模板版本
     */
    private Integer latestTemplateVersion;
    /**
     * 最新的模板类型
     */
    private Integer latestDefaultType;
    /**
     * 每月最多申请次数
     */
    private Integer maxTimePermonth;
    /**
     * 剩余申请次数
     */
    private Integer timesLeftThisMonth;
    /**
     * 申请内容时间限制，天为单位，N天内申请有效
     */
    private Integer contentTimeLimit;
    /**
     * 相关审批的位置
     */
    private Integer relaRequestNum;
    /**
     * 参与人的位置
     */
    private Integer relaPeopleNum;
    /**
     * 非常具体的适用范围,精确到人
     */
    private String rangeSpecific;
    /**
     * 适用范围的人群的companyInfoId
     */
    private String companyInfoIdRange;

    /**
     * 是否启用每月次数限制，0不用1用
     */
    private Integer isMaxTime;
    /**
     * 是否允许临时添加抄送人0不是，1是
     */
    private Integer isAllowAddTempCc;
    /**
     * 是否合并多身份，0不是1是
     */
    private Integer isMergeMultiId;

    private String createTime;
    private String disabletime;
    /**
     * 金额是否关联成本分析
     */
    private Integer isRelatedToCostAnalysis;
    /**
     * 是否允许在审批进程中修改审批流0不是1是
     */
    private Integer isAllowedToEditJudger;
    /**
     * 总成本
     */
    private BigDecimal totalCosts;
    /**
     * 条件审批流
     */
    private List<ConditionFlow> conditionFlow;
    /**
     * 特殊属性值
     */
    private Integer currentNum;

    private String priorityShow;    // 设置哪些组件在卡片中显示,格式如：1,3,4

    /**
     * 是否是常用审批模板
     */
    private Integer asGeneralTemplate;

    private Integer mustRelate;  // 强制关联任务或客户

    private String relateAnalysisNum;   // 关键成本分析组件计入项:xx,xx

    private Integer isRelateWorkTime;    //  加班时长是否计入调休时长

    private Integer templateGeneration; // 模板的generation

    private String componentGroupJson; // [{num:1, id:1}, {num:2, id:2}] --> 模板组件(num):关联组件集id(id)

    /**
     * 汇总普通组件时格式-->  {"nums":"xx,xx"}
     * 汇总组件集格式时-->   {"groupNums":"xx,xx", "subNums":["xx,xx", "yy,yy"]}
     * 汇总普通组件和组件集时格式 --> {"nums":"xx,xx", "groupNums":"yy,yy", "subNums":["zz,zz", "kk,kk"] }
     */
    private String moneyAmountNums;
    /**
     * 外出/出差打卡偏移
     */
    private String outSignOffset;

    private Integer participantRequired;

    private String proxyContactIds;

    private Integer isFinancial;

    private String financialFlow;

    private User user;

    private String modifyType;

    private Integer groupId;

    private Integer usualSort;

    public String getMoneyAmountNums() {
        return moneyAmountNums;
    }

    public void setMoneyAmountNums(String moneyAmountNums) {
        this.moneyAmountNums = moneyAmountNums;
    }

    public String getComponentGroupJson() {
        return componentGroupJson;
    }

    public void setComponentGroupJson(String componentGroupJson) {
        this.componentGroupJson = componentGroupJson;
    }

    public Integer getTemplateGeneration() {
        return templateGeneration;
    }

    public void setTemplateGeneration(Integer templateGeneration) {
        this.templateGeneration = templateGeneration;
    }

    public Integer getIsRelateWorkTime() {
        return isRelateWorkTime;
    }

    public void setIsRelateWorkTime(Integer isRelateWorkTime) {
        this.isRelateWorkTime = isRelateWorkTime;
    }

    public Integer getAsGeneralTemplate() {
        return asGeneralTemplate;
    }

    public void setAsGeneralTemplate(Integer asGeneralTemplate) {
        this.asGeneralTemplate = asGeneralTemplate;
    }

    public String getPriorityShow() {
        return priorityShow;
    }

    public void setPriorityShow(String priorityShow) {
        this.priorityShow = priorityShow;
    }

    public BigDecimal getAmount() {
        return amount;
    }

    public void setAmount(BigDecimal amount) {
        this.amount = amount;
    }

    public Integer getCurrentNum() {
        return currentNum;
    }

    public void setCurrentNum(Integer currentNum) {
        this.currentNum = currentNum;
    }

    public String getAncestorIds() {
        return ancestorIds;
    }

    public void setAncestorIds(String ancestorIds) {
        this.ancestorIds = ancestorIds;
    }

    public Integer getTemplateInsertId() {
        return templateInsertId;
    }

    public void setTemplateInsertId(Integer templateInsertId) {
        this.templateInsertId = templateInsertId;
    }

    public List<ConditionFlow> getConditionFlow() {
        return conditionFlow;
    }

    public void setConditionFlow(List<ConditionFlow> conditionFlow) {
        this.conditionFlow = conditionFlow;
    }

    public Integer getRelaPeopleNum() {
        return relaPeopleNum;
    }

    public void setRelaPeopleNum(Integer relaPeopleNum) {
        this.relaPeopleNum = relaPeopleNum;
    }

    public BigDecimal getTotalCosts() {
        return totalCosts;
    }

    public void setTotalCosts(BigDecimal totalCosts) {
        this.totalCosts = totalCosts;
    }

    public Integer getIsAllowedToEditJudger() {
        return isAllowedToEditJudger;
    }

    public void setIsAllowedToEditJudger(Integer isAllowedToEditJudger) {
        this.isAllowedToEditJudger = isAllowedToEditJudger;
    }

    public Integer getIsRelatedToCostAnalysis() {
        return isRelatedToCostAnalysis;
    }

    public void setIsRelatedToCostAnalysis(Integer isRelatedToCostAnalysis) {
        this.isRelatedToCostAnalysis = isRelatedToCostAnalysis;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getDisabletime() {
        return disabletime;
    }

    public void setDisabletime(String disabletime) {
        this.disabletime = disabletime;
    }

    public Integer getIsMergeMultiId() {
        return isMergeMultiId;
    }

    public void setIsMergeMultiId(Integer isMergeMultiId) {
        this.isMergeMultiId = isMergeMultiId;
    }

    public Integer getIsAllowAddTempCc() {
        return isAllowAddTempCc;
    }

    public void setIsAllowAddTempCc(Integer isAllowAddTempCc) {
        this.isAllowAddTempCc = isAllowAddTempCc;
    }

    public Integer getIsMaxTime() {
        return isMaxTime;
    }

    public void setIsMaxTime(Integer isMaxTime) {
        this.isMaxTime = isMaxTime;
    }

    public Integer getTimesLeftThisMonth() {
        return timesLeftThisMonth;
    }

    public void setTimesLeftThisMonth(Integer timesLeftThisMonth) {
        this.timesLeftThisMonth = timesLeftThisMonth;
    }

    public String getRangeSpecific() {
        return rangeSpecific;
    }

    public void setRangeSpecific(String rangeSpecific) {
        this.rangeSpecific = rangeSpecific;
    }

    public Integer getRelaRequestNum() {
        try {
            return relaRequestNum;
        } catch (Exception e) {
            EmailUtils.sendMail("获取数据报错了", "relaRequestNum");
            return 0;
        }
    }

    public void setRelaRequestNum(Integer relaRequestNum) {
        try {
            this.relaRequestNum = relaRequestNum;
        } catch (Exception e) {
            EmailUtils.sendMail("设置数据报错了", "relaRequestNum");
            this.relaRequestNum = 0;
        }
    }

    public Integer getMaxTimePermonth() {
        return maxTimePermonth;
    }

    public void setMaxTimePermonth(Integer maxTimePermonth) {
        this.maxTimePermonth = maxTimePermonth;
    }

    public Integer getContentTimeLimit() {
        return contentTimeLimit;
    }

    public void setContentTimeLimit(Integer contentTimeLimit) {
        this.contentTimeLimit = contentTimeLimit;
    }

    public Integer getLatestDefaultType() {
        return latestDefaultType;
    }

    public void setLatestDefaultType(Integer latestDefaultType) {
        this.latestDefaultType = latestDefaultType;
    }

    public Integer getLatestTemplateId() {
        return latestTemplateId;
    }

    public void setLatestTemplateId(Integer latestTemplateId) {
        this.latestTemplateId = latestTemplateId;
    }

    public Integer getLatestTemplateVersion() {
        return latestTemplateVersion;
    }

    public void setLatestTemplateVersion(Integer latestTemplateVersion) {
        this.latestTemplateVersion = latestTemplateVersion;
    }

    public Integer getAncestorId() {
        return ancestorId;
    }

    public void setAncestorId(Integer ancestorId) {
        this.ancestorId = ancestorId;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public String getSiftingBy() {
        return siftingBy;
    }

    public void setSiftingBy(String siftingBy) {
        this.siftingBy = siftingBy;
    }

    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }

    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public Integer getDataNum() {
        return dataNum;
    }

    public void setDataNum(Integer dataNum) {
        this.dataNum = dataNum;
    }

    public BigDecimal getAmountTop() {
        return amountTop;
    }

    public void setAmountTop(BigDecimal amountTop) {
        this.amountTop = amountTop;
    }

    public int getDefaultType() {
        return defaultType;
    }

    public void setDefaultType(int defaultType) {
        this.defaultType = defaultType;
    }

    public int getVersion() {
        return version;
    }

    public void setVersion(int version) {
        this.version = version;
    }

    public String getTemplateColor() {
        return templateColor;
    }

    public void setTemplateColor(String templateColor) {
        this.templateColor = templateColor;
    }

    public int getTemplateId() {
        return templateId;
    }

    public void setTemplateId(int templateId) {
        this.templateId = templateId;
    }

    public String getTemplateName() {
        return templateName;
    }

    public void setTemplateName(String templateName) {
        this.templateName = templateName;
    }

    public String getTemplateMetaName() {
        return templateMetaName;
    }

    public void setTemplateMetaName(String templateMetaName) {
        this.templateMetaName = templateMetaName;
    }

    public String getTemplateTips() {
        return templateTips;
    }

    public void setTemplateTips(String templateTips) {
        this.templateTips = templateTips;
    }

    public String getTemplateComponent() {
        return templateComponent;
    }

    public void setTemplateComponent(String templateComponent) {
        this.templateComponent = templateComponent;
    }

    public Integer getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Integer companyId) {
        this.companyId = companyId;
    }

    public String getDepartmentId() {
        return departmentId;
    }

    public void setDepartmentId(String departmentId) {
        this.departmentId = departmentId;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getRequestFlow() {
        return requestFlow;
    }

    public void setRequestFlow(String requestFlow) {
        this.requestFlow = requestFlow;
    }

    public String getCc() {
        return cc;
    }

    public void setCc(String cc) {
        this.cc = cc;
    }

    public String getMultiChosen() {
        return multiChosen;
    }

    public void setMultiChosen(String multiChosen) {
        this.multiChosen = multiChosen;
    }

    public Integer getMustRelate() {
        return mustRelate;
    }

    public void setMustRelate(Integer mustRelate) {
        this.mustRelate = mustRelate;
    }

    public String getRelateAnalysisNum() {
        return relateAnalysisNum;
    }

    public void setRelateAnalysisNum(String relateAnalysisNum) {
        this.relateAnalysisNum = relateAnalysisNum;
    }

    public String getCompanyInfoIdRange() {
        return companyInfoIdRange;
    }

    public void setCompanyInfoIdRange(String companyInfoIdRange) {
        this.companyInfoIdRange = companyInfoIdRange;
    }

    public String getOutSignOffset() {
        return outSignOffset;
    }

    public void setOutSignOffset(String outSignOffset) {
        this.outSignOffset = outSignOffset;
    }

    public Integer getParticipantRequired() {
        return participantRequired;
    }

    public void setParticipantRequired(Integer participantRequired) {
        this.participantRequired = participantRequired;
    }

    public String getProxyContactIds() {
        return proxyContactIds;
    }

    public void setProxyContactIds(String proxyContactIds) {
        this.proxyContactIds = proxyContactIds;
    }

    public Integer getIsFinancial() {
        return isFinancial;
    }

    public void setIsFinancial(Integer isFinancial) {
        this.isFinancial = isFinancial;
    }

    public String getFinancialFlow() {
        return financialFlow;
    }

    public void setFinancialFlow(String financialFlow) {
        this.financialFlow = financialFlow;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getModifyType() {
        return modifyType;
    }

    public void setModifyType(String modifyType) {
        this.modifyType = modifyType;
    }


    public Integer getGroupId() {
        return groupId;
    }

    public void setGroupId(Integer groupId) {
        this.groupId = groupId;
    }

    public Integer getUsualSort() {
        return usualSort;
    }

    public void setUsualSort(Integer usualSort) {
        this.usualSort = usualSort;
    }

    @Override
    public String toString() {
        return JSONObject.toJSONString(this);
    }
}
